/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package co.edu.unitecnologica.modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author osalcedo
 */
@Entity
@Table(name = "objetos")
@NamedQueries({@NamedQuery(name = "Objetos.findAll", query = "SELECT o FROM Objetos o"), @NamedQuery(name = "Objetos.findByCod", query = "SELECT o FROM Objetos o WHERE o.cod = :cod"), @NamedQuery(name = "Objetos.findByNombre", query = "SELECT o FROM Objetos o WHERE o.nombre = :nombre"), @NamedQuery(name = "Objetos.findByVersion", query = "SELECT o FROM Objetos o WHERE o.version = :version"), @NamedQuery(name = "Objetos.findByTipo", query = "SELECT o FROM Objetos o WHERE o.tipo = :tipo")})
public class Objetos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cod")
    private Integer cod;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "version")
    private Float version;
    @Column(name = "tipo")
    private String tipo;
    @ManyToMany(mappedBy = "objetosCollection")
    private Collection<Roles> rolesCollection;

    public Objetos() {
    }

    public Objetos(Integer cod) {
        this.cod = cod;
    }

    public Objetos(Integer cod, String nombre) {
        this.cod = cod;
        this.nombre = nombre;
    }

    public Integer getCod() {
        return cod;
    }

    public void setCod(Integer cod) {
        this.cod = cod;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Float getVersion() {
        return version;
    }

    public void setVersion(Float version) {
        this.version = version;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public Collection<Roles> getRolesCollection() {
        return rolesCollection;
    }

    public void setRolesCollection(Collection<Roles> rolesCollection) {
        this.rolesCollection = rolesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cod != null ? cod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Objetos)) {
            return false;
        }
        Objetos other = (Objetos) object;
        if ((this.cod == null && other.cod != null) || (this.cod != null && !this.cod.equals(other.cod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.edu.unitecnologica.modelo.Objetos[cod=" + cod + "]";
    }

}
